<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;

/***
 *  启动redis服务 redis-server
 *  命令 php artisan queue:work
 *  调用 SendMessage::dispatch();  //分发任务
 */
class SendMessage implements ShouldQueue
{
   use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

   /**
    * Create a new job instance.
    *
    * @return void
    */
   public function __construct()
   {
      //
   }

   /**
    * Execute the job.
    *
    * @return void
    */
   public function handle()
   {
      $data = \Redis::get('name');
      \Log::info('redis', json_decode($data, true));
   }
}
